﻿<UserControl x:Class="HeritageAcademy.Window.WindowFrame"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
    xmlns:local="clr-namespace:HeritageAcademy.Window"
	x:Name="windowFrame"
	d:DesignWidth="1000" d:DesignHeight="640">

	<Grid x:Name="grid">
		<Grid.RowDefinitions>
			<RowDefinition Height="50"/>
			<RowDefinition/>
		</Grid.RowDefinitions>
            
        <!-- Drag target -->
		<Rectangle x:Name="dragTarget" Fill="Transparent" Margin="150,0,0,0"/>
			
        <!-- Window Content -->
        <local:WindowContent Margin="0" Width="Auto" Height="Auto" Grid.RowSpan="2" />
        
        <!-- Window controls grid -->
        <Grid x:Name="ControlBtnGrid" HorizontalAlignment="Right" Margin="0,12,0,4" VerticalAlignment="Top">
			<StackPanel HorizontalAlignment="Right" Margin="0,0,13,0" VerticalAlignment="Center" Grid.Column="2" Orientation="Horizontal">
                    
                <!-- Minimize button -->
                <Button x:Name="MinimizeButton" Width="20" Height="30" Click="minimize_Click" >
                    <Button.Style>
                        <Style BasedOn="{StaticResource OpacityButton}" TargetType="Button">
                            <Setter Property="Visibility" Value="Visible" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Source={x:Static Application.Current}, Path=MainWindow.WindowState}" Value="Minimized">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                    <Canvas Width="12" Height="10">
                        <Rectangle Canvas.Top="6" Width="10" Height="3" Stroke="Gray" StrokeThickness="2" />
                    </Canvas>
                </Button>
                    
                <!-- Maximize button -->
                <Button x:Name="MaximizeButton" Width="20" Height="30" Click="maximize_Click" >
                    <Button.Style>
                        <Style BasedOn="{StaticResource OpacityButton}" TargetType="Button">
                            <Setter Property="Visibility" Value="Visible" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Source={x:Static Application.Current}, Path=MainWindow.WindowState}" Value="Maximized">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                    <Canvas Width="12" Height="10">
                        <Rectangle Canvas.Top="1" Width="11" Height="9" Stroke="Gray" StrokeThickness="2"  />
                    </Canvas>
                </Button>
                    
                <!-- Restore button -->
                <Button x:Name="RestoreButton" Width="20" Height="30" Click="restore_Click" >
                    <Button.Style>
                        <Style BasedOn="{StaticResource OpacityButton}" TargetType="Button">
                            <Setter Property="Visibility" Value="Visible" />
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding Source={x:Static Application.Current}, Path=MainWindow.WindowState}" Value="Normal">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Button.Style>
                    <Canvas Width="12" Height="10">
                        <Rectangle Canvas.Left="3" Width="8" Height="7" Stroke="Gray" StrokeThickness="2" />
                        <Rectangle Canvas.Top="3" Width="8" Height="7" Stroke="Gray" StrokeThickness="2" />
                    </Canvas>
                </Button>
                    
                <!-- Close button -->
                <Button x:Name="CloseButton" Style="{StaticResource OpacityButton}" Width="20" Height="30" Margin="0,0,8,0" Click="close_Click" >
                    <Path Width="10" Height="10" Stroke="Gray" StrokeThickness="2.2" Data="{StaticResource CloseX}" Stretch="Fill" />
                </Button>
                    
            </StackPanel>
		</Grid>
	</Grid>
</UserControl>